import Foundation
import UIKit
import Maaku

// MARK: - Font Style Extensions
public extension Maaku.FontStyle {
    var blockQuote: Maaku.Font {
        return .italicSystemFont(ofSize: 16)
    }
    
    var codeBlock: Maaku.Font {
        return .monospacedSystemFont(ofSize: 14, weight: .regular)
    }
    
    var inlineCode: Maaku.Font {
        return .monospacedSystemFont(ofSize: 14, weight: .regular)
    }
    
    var link: Maaku.Font {
        return .systemFont(ofSize: 16, weight: .medium)
    }
    
    var listItem: Maaku.Font {
        return .systemFont(ofSize: 16)
    }
    
    var paragraph: Maaku.Font {
        return .systemFont(ofSize: 16)
    }
    
    var strikethrough: Maaku.Font {
        return .systemFont(ofSize: 16, weight: .light)
    }
    
    var emphasis: Maaku.Font {
        return .italicSystemFont(ofSize: 16)
    }
    
    var strong: Maaku.Font {
        return .boldSystemFont(ofSize: 16)
    }
}


 // 扩展 UIFont 以支持添加特性
extension UIFont {
    func withTraits(_ traits: UIFontDescriptor.SymbolicTraits) -> UIFont? {
        guard let descriptor = fontDescriptor.withSymbolicTraits(traits) else {
            return nil
        }
        return UIFont(descriptor: descriptor, size: 0) // size 0 表示使用原始大小
    }
}